(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Using rosserial with Inforce MBED PAC Shield

Description: This tutorial show how to use rosserial_mbed with the Inforce 6410 plus + PAC Shield

Keywords: Inforce PAC MBED serial rosserial

Tutorial Level: BEGINNER

Using rosserial with Inforce MBED PAC Shield

Downloading the required files

Login to Inforce's website and download the BSP package: at the time this wiki was written it was: SYS6410P_Ubuntu_Linux_BSP_880411_V1.zip unzip it and place it somewhere on your home directory, e.g.:

  •     $ unzip SYS6410P_Ubuntu_Linux_BSP_880411_V1.zip -d ~/SYS6410P_BSP

Download an install PPA for your specific Ubuntu version form here: https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded

Generating ros_lib

Create a new empty workspace for rosserial:

  • $ cd ~/SYS6410P_BSP
    $ mkdir -p rosserial_ws/src
    $ cd rosserial_ws/src

Clone the rosserial repo from github and checkout to the jade-devel branch:

  • $ git clone https://github.com/ros-drivers/rosserial -b jade-devel

Move to the root of your new workspace:

  • $ cd ..

and from there execute:

  • $ catkin_make

and then:

  • $ source devel/setup.bash

From that same terminal, generate the libraries that we will need later for your mbed project, e.g.:

  • $ rosrun rosserial_mbed make_libraries.py ~/SYS6410P_BSP/

That should create a new directory called ros_libs with all the involved libraries, on the path you wrote inside the brackets

Download and run the demo project

You can clone this demo that make use of some of the capabilities of the MBED PAC Shield for the Inforce 6410 plus board.

Clone this Github repo into your prefered directory:

  • $ git clone https://github.com/creativa77/ifc6410p_mbed_ros_demo ros_demo

You can access the instructions of this demo from its Github main page or by reading the README.md file on your downloaded ros_demo directory.

Importing your project into the custom build system

Copy your project directory into mbed-master/libraries/tests/ros/ for example:

  • $ cp -r ~/ros_demo ~/SYS6410P/mbed-master/libraries/tests/ros/

Open the tests.py script from ~/SYS6410P/mbed-master/workspace_tools/tests.py and search for a series of braces with something similar to this:

  • {
        "id": "ROSSERIAL_MBED_PAC", "description": "Example of rosserial_mbed on PAC board",
        "source_dir": join(TEST_DIR, "ros", "ros_demo"),
        "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, CPPUTEST_LIBRARY],
        "automated": False,
        "mcu": ["PAC_F401RB"],
    },

You should make a copy of one of those and edit it with your own project's description and dependencies and place it at the end of the existing list to make things easier for the next step.

from the ~ /SYS6410P/mbed-master/workspace_tools/ directory, do:

  • $ python make.py

it will answer with an error and will show you some instructions about the usage and an enumerated list with all the available projects. Your project should appear at the end of this list with a number. Example:

  • [ERROR] You have to specify one of the following tests:
    [  0] MBED_A1: Basic
    [  1] MBED_A2: Semihost file system
    [  2] MBED_A3: C++ STL
    [  3] MBED_A4: I2C TMP102
    [  4] MBED_A5: DigitalIn DigitalOut
    [  5] MBED_A6: DigitalInOut
    [  6] MBED_A7: InterruptIn
    [  7] MBED_A8: Analog
    [  8] MBED_A9: Serial Echo at 115200
    ...
    [135] ROSSERIAL_MBED_PAC: Example of rosserial_mbed on PAC board

Execute again the script but this time as shown on the next line and replace the last number with your project's number as shown on the command from above.

  • $ sudo python make.py -m PAC_F401RB -t GCC_ARM -d ~/SYS6410P_BSP/ -p 135

It will compile the project and create a .bin file ready to be burned into the board

Downloading the code into the MBED PAC shield

Now, depending on where you are doing the work, you must copy the .bin into the stm32 flash: If you are working on a remote computer, say, a laptop. One way would be copying the file through ssh, example:

  • $ scp ~/SYS6410P_BSP/rosserial_mbed_pac.bin linaro@192.168.1.101:

You must have correctly installed and configured SSH in your own board and use their use their corresponding user and IP.

Once the .bin is placed into your board's memory, and assuming the .bin is placed on your home directory, run this command in order to burn it into the stm32 microcontroller of the PAC board:

  • stm32flash -w ~/rosserial_mbed_pac.bin -v -g 0x0 /dev/ttyHS2 -R

where:

  • [-w filename] write the file
    [-v] verify writes
    [-g address] start execution at specified address
    [-R] restart device at exit

Video of the demo running

Here's a demo video of the Inforce 6410P with rosserial_mbed in action:

Wiki: rosserial_mbed/Tutorials/Using rosserial with Inforce MBED PAC Shield (last edited 2015-11-20 13:24:10 by AlexisPojomovsky)